//
//  GCDAsyncViewController.m
//  FKGCDTestDemo
//
//  Created by 云眼科技 on 16/7/29.
//  Copyright © 2016年 CloudEyes. All rights reserved.
//

#import "GCDAsyncViewController.h"

@interface GCDAsyncViewController ()
@property (nonatomic, strong) NSMutableArray <NSString *> *dataArray;
@end


static NSString *const GCDAsyncCellIdentifier = @"GCDAsyncCellIdentifier";

@implementation GCDAsyncViewController
- (void)viewDidLoad {
    [super viewDidLoad];
    self.title = @"GCD-Async";
    [self.tableView registerClass:[UITableViewCell class] forCellReuseIdentifier:GCDAsyncCellIdentifier];
    self.tableView.tableFooterView = [[UIView alloc] initWithFrame:CGRectZero];
}

-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section {
    return self.dataArray.count;
}

-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath {
    UITableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:GCDAsyncCellIdentifier forIndexPath:indexPath];
    cell.textLabel.text = self.dataArray[indexPath.row];
    return cell;
}

-(void)tableView:(UITableView *)tableView didSelectRowAtIndexPath:(NSIndexPath *)indexPath{
    [tableView deselectRowAtIndexPath:indexPath animated:YES];
}


-(NSMutableArray<NSString *> *)dataArray{
    if (!_dataArray) {
        _dataArray = [[NSMutableArray alloc] init];
        [_dataArray addObject:@"GCD-Sync"];
        [_dataArray addObject:@"GCD-Async"];
    }
    return _dataArray;
}

@end
